//
//  AddViewController.m
//  UpNote
//
//  Created by Justsoso on 16/4/2.
//  Copyright © 2016年 Justsoso. All rights reserved.
//

#import "AddViewController.h"

@interface AddViewController ()
@property (weak, nonatomic) IBOutlet UITextView *contentTextView;

@end

@implementation AddViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    if (self.note != nil)
    {
        self.contentTextView.text = self.note.Content;
    }
}


- (IBAction)saveBtnPressed:(id)sender
{
    if (self.note == nil)
    {
        [self.delegate addNoteContent:self.contentTextView.text];
    }
    else
    {
        self.note.Content = self.contentTextView.text;
        [self.delegate refresh];
    }
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (IBAction)cancelBtnPressed:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
